<?
/*----------------------------------------------------------------------
          (C) Bobtail-Bear 2006 	小飞熊新一代下载系统
          	代码编写：小飞熊	版权所有：小飞熊[L.F.Bear]
				官方网站/技术支持：http://www.lfbear.cn
------------------------------------------------------------------------
          (C) Bobtail-Bear 2006 	L.F.Bear's New Download Sysytem
          	Powered by L.F.Bear  Copyright L.F.Bear's Home(R)
               Official Web/Support：http://www.lfbear.cn
-----------------------------------------------------------------------*/

//本页脚本功能：快速浏览、复制附件URL
echo ("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />");
session_start();
if ($_COOKIE[status]=="login" && $_SESSION[login]=="yes")
{
require("../include/config.base.php");
require("../include/config.inc.php");
$uploadpath=$system_http."/".$path_upload;
$action=$_GET[action];
switch($action){
case copyurl:
$fname=$_GET[fname];
$uppath=$uploadpath."/";
print <<<EOT
<Meta http-equiv='Refresh' Content='1; Url=seefile.php'>	
<link href="images/css.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#DDF1FF"><br><br><br><br><br><br>
<table width="750" border="1" align="center" cellpadding=4 cellspacing=0 bordercolor="#ACC1FC" heoght=400>
  <tr bgcolor='#ACC1FC'>
    <td width="728"><a class="title">自动复制文件名</a></td>
  </tr>
  <tr bgcolor='#FFFFFF'>
    <td bgcolor="#EBE9ED" class="comments-title" align="center"><br>状态：文件名 <input name="cname" type="text" id="cname" value="$fname" size="50" readonly> <br><br>已经复制到剪贴板，自动返回中…</td>
  </tr>
  <tr bgcolor='#FFFFFF'>
    <td bgcolor="#FFFFFF" class="comments-title">&nbsp;<input name="qianzhui" type="hidden" id="qianzhui" value="$uppath"></td>
  </tr> 
</table>
	<script language="javascript">

{
	cname.value=qianzhui.value+cname.value;
	cname.focus()
	cname.select()
	therange=cname.createTextRange()
	therange.execCommand("Copy")
}
</script>

EOT;
break;

default:

$dir="../".$path_upload;
$handle=opendir($dir);
$i=0;unset($show);
while ($file = readdir($handle)) {
    if($file=="." || $file=="..") $show=$show; 
    else {
    $showfile=$file;$i++;
    $size=number_format(filesize("../".$path_upload."/".$file)/1024,2);
    $time=date("Ynd H:i:s", filemtime("../".$path_upload."/".$file));
    $show.="
    文件名：<input name=\"filename_$i\" type=\"text\" id=\"filename_$i\" value=\"$showfile\" size=\"40\" readonly> [<a href=seefile.php?action=copyurl&fname=$showfile>复制文件地址</a>]&nbsp;
    &nbsp;<font color=blue>文件信息：<a title=\"文件大小\">$size KB</a> / <a title=\"详细上传时间\">$time</a></font>&nbsp;

<br>
";}
}
if($show=="") $show="目前无上传附件";
closedir($handle); 


print <<<EOT
<head>
<TITLE>复制文件地址---附件浏览</TITLE>
<link href="images/css.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#DDF1FF"><br><br><br><br><br><br>
<table width="750" border="1" align="center" cellpadding=4 cellspacing=0 bordercolor="#ACC1FC" heoght=400>
  <tr bgcolor='#ACC1FC'>
    <td width="728"><a class="title">复制文件地址</a></td>
  </tr>
  <tr bgcolor='#FFFFFF'>
    <td bgcolor="#EBE9ED" class="comments-title"></td>
  </tr>
  <tr bgcolor='#FFFFFF'>
    <td bgcolor="#FFFFFF"><a class="sidetitle">附件目录 $uploadpath </a></td>
  </tr>
						<tr>
							<td bgcolor="#FFFFFF">$show</td>
						</tr>
					  		 	<tr>
							<td bgcolor="#FFFFFF">&nbsp;</td>
						</tr>
                          </form>
</table>
EOT;
exit;
die;
break;
}
}
else die("Error Parameter,Forbidden Access!");
?>




